package store.aixx.jwt.demo.exception;

import store.aixx.jwt.demo.common.IErrorStatus;
import store.aixx.jwt.demo.util.MessageUtil;

/**
 * @author yukai
 * @since 2021年12月11日 22:09
 */
public class LocalBizServiceException extends RuntimeException{

    public IErrorStatus errorStatus;

    public LocalBizServiceException(IErrorStatus errorStatus, Object...i18nArgs){
        super(MessageUtil.getMessage(errorStatus.getMessage(), i18nArgs));
        this.errorStatus = errorStatus;
    }

    /**
     * 抛出业务层异常
     *
     * @param errorStatus 异常状态
     * @param i18nArgs i18n参数
     */
    public static void THROW(IErrorStatus errorStatus, Object...i18nArgs){
        throw new LocalBizServiceException(errorStatus, i18nArgs);
    }

}
